package com.mine.controller.state;

// GameContext表示游戏的上下文，持有游戏的当前状态
public class GameContext {
    private GameState gameState;
    // 游戏状态常量
    public static final int GAME_STATUS_NOT_READY = -1, GAME_STATUS_READY = 0,
            GAME_STATUS_BEGIN = 1, GAME_STATUS_PLAYING = 3,
            GAME_STATUS_LOSE = 99, GAME_STATUS_WIN = 100;
    // 游戏当前关卡游戏状态
    private int gameStatus;

    public GameContext() {
        // 初始化游戏的状态为未准备状态
        this.gameState = new NotReadyState();
    }

    public void setState(GameState gameState) {
        this.gameState = gameState;
    }

    public GameState getState() {
        return gameState;
    }

    // doAction()方法会调用当前游戏状态的play()方法
    public void doAction() {
        gameState.play(this);
    }

    public int getGameStatus() {
        return gameStatus;
    }

    public void setGameStatus(int gameStatus){
        this.gameStatus = gameStatus;
    }
}